'use strict';
const db = uniCloud.database()
const article = db.collection('article_data')
exports.main = async (event, context) => {
	//event为客户端上传的参数
	let params = event
	let data;
	let pageSize = event.pageSize || 10
	let currentPage = event.currentPage || 1
	delete params.openid
	delete params.pageSize
	delete params.currentPage
	data = await article.where(params).skip(pageSize * (currentPage - 1)).limit(pageSize).get()
	//返回数据给客户端
	return {
		code: 200,
		data
	}
};